﻿Imports System.IO
Imports DevComponents.DotNetBar.Metro.ColorTables
Imports DevComponents.DotNetBar

Public Class Main

    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()
        'Dim login As New ucDangnhap()
        'login.Dock = DockStyle.Fill
        'Me.ShowModalPanel(login, DevComponents.DotNetBar.Controls.eSlideSide.Right)



        ' Add any initialization after the InitializeComponent() call.

        '' Add metro color themes
        ChangeMetroTheme = New Command(components, New EventHandler(AddressOf ChangeMetroThemeExecuted))
        Dim metroThemes() As MetroColorGeneratorParameters = MetroColorGeneratorParameters.GetAllPredefinedThemes()
        For Each mt As MetroColorGeneratorParameters In metroThemes
            Dim theme As New ButtonItem(mt.ThemeName, mt.ThemeName)
            theme.Command = ChangeMetroTheme
            theme.CommandParameter = mt
            colorThemeButton.SubItems.Add(theme)
        Next mt

        '    'Dim uc As New ucDangnhap()
        '    'uc.Dock = DockStyle.Fill
        '    'Me.Controls.Add(uc)
        '    'Me.ShowModalPanel(uc, DevComponents.DotNetBar.Controls.eSlideSide.Left)

        LoadDSHanghoa()
        LoadDSCongty()
        LoadDanhmucSP()
        LoadDSNhaSX()
        LoadDSPhieunhap()
        LoadDSPhieuXuat()
        LoadDSThu()
        LoadDSChi()
        LoadDSNoPhaiThu()
        LoadDSNoPhaiTra()

    End Sub

    Private _ChangeMetroTheme As Command
    ''' <summary>
    ''' Changes the Metro theme.
    ''' </summary>
    Public Property ChangeMetroTheme() As Command
        Get
            Return _ChangeMetroTheme
        End Get
        Set(ByVal value As Command)
            _ChangeMetroTheme = value
        End Set
    End Property


    Private Sub ChangeMetroThemeExecuted(ByVal sender As Object, ByVal e As EventArgs)
        Dim source As ICommandSource = CType(sender, ICommandSource)
        Dim theme As MetroColorGeneratorParameters = CType(source.CommandParameter, MetroColorGeneratorParameters)
        StyleManager.MetroColorGeneratorParameters = theme
    End Sub

    Private Sub LoadDSHanghoa()
        Dim uc As New ucDSHanghoa()
        uc.Dock = DockStyle.Fill
        Me.MetroTabPanelHanghoa.Controls.Add(uc)
        Me.MetroTabPanelHanghoa.Show()
    End Sub

    Private Sub LoadDSCongty()
        Dim uc As ucDSCongty = Nothing
        uc = New ucDSCongty()
        uc.Dock = DockStyle.Fill
        Me.MetroTabPanelCongty.Controls.Add(uc)
        Me.MetroTabPanelCongty.Show()
    End Sub

    Private Sub LoadDanhmucSP()
        Dim uc As ucDSDanhmucsanpham = Nothing
        uc = New ucDSDanhmucsanpham()
        uc.Dock = DockStyle.Fill
        Me.MetroTabPanelDanhmucsp.Controls.Add(uc)
        Me.MetroTabPanelDanhmucsp.Show()
    End Sub

    Private Sub LoadDSNhaSX()
        Dim uc As ucDSNhasanxuat = Nothing
        uc = New ucDSNhasanxuat()
        uc.Dock = DockStyle.Fill
        Me.MetroTabPanelNhasx.Controls.Add(uc)
        Me.MetroTabPanelNhasx.Show()
    End Sub

    Private Sub LoadDSPhieunhap()
        Dim uc As ucHangnhap = Nothing
        uc = New ucHangnhap()
        uc.Dock = DockStyle.Fill
        Me.MetroTabPanelHangnhap.Controls.Add(uc)
        Me.MetroTabPanelHangnhap.Show()
    End Sub

    Private Sub LoadDSPhieuxuat()
        Dim uc As ucDSHangxuat = Nothing
        uc = New ucDSHangxuat()
        uc.Dock = DockStyle.Fill
        Me.MetroTabPanelHangxuat.Controls.Add(uc)
        Me.MetroTabPanelHangxuat.Show()
    End Sub

    Private Sub LoadDSThu()
        Dim uc As ucDSThu = Nothing
        uc = New ucDSThu()
        uc.Dock = DockStyle.Fill
        Me.MetroTabPanelThu.Controls.Add(uc)
        Me.MetroTabPanelThu.Show()
    End Sub

    Private Sub LoadDSChi()
        Dim uc As ucDSChi = Nothing
        uc = New ucDSChi()
        uc.Dock = DockStyle.Fill
        Me.MetroTabPanelChi.Controls.Add(uc)
        Me.MetroTabPanelChi.Show()
    End Sub

    Private Sub LoadDSNoPhaiThu()
        Dim uc As ucDSNophaithu = Nothing
        uc = New ucDSNophaithu()
        uc.Dock = DockStyle.Fill
        Me.MetroTabPanelNothu.Controls.Add(uc)
        Me.MetroTabPanelNothu.Show()
    End Sub

    Private Sub LoadDSNoPhaiTra()
        Dim uc As ucDSNophaitra = Nothing
        uc = New ucDSNophaitra()
        uc.Dock = DockStyle.Fill
        Me.MetroTabPanelNotra.Controls.Add(uc)
        Me.MetroTabPanelNotra.Show()
    End Sub


    Private Sub BubbleButtonLapbaocao_Click(sender As Object, e As ClickEventArgs) Handles BubbleButtonLapbaocao.Click
        Dim uc As New ucLapbaocao
        uc.Dock = DockStyle.Fill
        Dim parent = DirectCast(Application.OpenForms.Item(0), Main)
        parent.ShowModalPanel(uc, DevComponents.DotNetBar.Controls.eSlideSide.Left)
    End Sub

    Private Sub ButtonItemDSNguoidung_Click(sender As Object, e As EventArgs) Handles ButtonItemDSNguoidung.Click
        Dim uc As New ucThongtinnguoidung
        uc.Dock = DockStyle.Fill
        Dim parent = DirectCast(Application.OpenForms.Item(0), Main)
        parent.ShowModalPanel(uc, DevComponents.DotNetBar.Controls.eSlideSide.Left)
    End Sub

    Private Sub ButtonItemDoimatkhau_Click(sender As Object, e As EventArgs) Handles ButtonItemDoimatkhau.Click
        Dim uc As New ucDoimatkhau
        uc.Dock = DockStyle.Fill
        Dim parent = DirectCast(Application.OpenForms.Item(0), Main)
        parent.ShowModalPanel(uc, DevComponents.DotNetBar.Controls.eSlideSide.Left)
    End Sub

    Private Sub BubbleButton9_Click(sender As Object, e As ClickEventArgs) Handles BubbleButton9.Click
        Dim uc As New ucThongtinnguoidung
        uc.Dock = DockStyle.Fill
        Dim parent = DirectCast(Application.OpenForms.Item(0), Main)
        parent.ShowModalPanel(uc, DevComponents.DotNetBar.Controls.eSlideSide.Left)
    End Sub

    Private Sub BubbleButtonTygiahoidoai_Click(sender As Object, e As ClickEventArgs) Handles BubbleButtonTygiahoidoai.Click
        Dim uc As New ucTygiahoidoai
        uc.Dock = DockStyle.Fill
        Dim parent = DirectCast(Application.OpenForms.Item(0), Main)
        parent.ShowModalPanel(uc, DevComponents.DotNetBar.Controls.eSlideSide.Left)
    End Sub

    Private Sub BubbleButtonGioithieu_Click(sender As Object, e As ClickEventArgs) Handles BubbleButtonGioithieu.Click
        Dim uc As New ucGioithieu
        Dim parent = DirectCast(Application.OpenForms.Item(0), Main)
        parent.ShowModalPanel(uc, DevComponents.DotNetBar.Controls.eSlideSide.Left)
    End Sub

    Private Sub BubbleButtonExit_Click(sender As Object, e As ClickEventArgs) Handles BubbleButtonExit.Click
        If MessageBoxEx.Show("Bạn có chắc chắn muốn thoát chương trình?", "Thoát chương trình", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
            Application.Exit()
            Dispose()
        End If
    End Sub

    Private Sub ButtonItemThoat_Click(sender As Object, e As EventArgs) Handles ButtonItemThoat.Click
        If MessageBoxEx.Show("Bạn có chắc chắn muốn thoát chương trình?", "Thoát chương trình", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
            Application.Exit()
            Dispose()
        End If
    End Sub

    Private Sub BubbleButtonUSD_Click(sender As Object, e As ClickEventArgs) Handles BubbleButtonUSD.Click
        BubbleButtonUSD.Visible = False
        BubbleButtonVND.Visible = True
    End Sub

    Private Sub BubbleButtonVND_Click(sender As Object, e As ClickEventArgs) Handles BubbleButtonVND.Click
        BubbleButtonUSD.Visible = True
        BubbleButtonVND.Visible = False
    End Sub
End Class
